var Folder = require('../../../class/Folder');

module.exports = {
  prefix: '/folder/',
  get: {
    ':_id': {
      method: function*() {
        var _id = this.params._id;
        console.log(_id);

        var result = yield Folder.find(_id);

        this.body = result;
      }
    }
  },
  post: {
    '': {
      des: {},
      method: function*() {
        var self = this;

        var data = yield parse(self.request);

        var result = yield new Folder(data).save();

        self.body = result;
      }
    },
    ':_id': {
      method: function*() {
        var self = this;

        var _id = self.params._id;

        var data = yield parse(self.request);

        data.folder = _id;

        var result = yield new Folder(data).save();

        self.body = result;
      }
    }
  }
};
